* {
    box-sizing: border-box;
}

body {
    /* 弹性布局，垂直居中 */
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #99cdff;
    overflow: hidden;
}

.search {
    /* 子元素绝对定位，父元素相对定位 */
    position: relative;
    height: 50px;
}

.search .input {
    padding: 15px;
    height: 50px;
    width: 50px;
    border: 0;
    background-color: #fff;
    font-size: 18px;
    transition: width 0.3s ease;
}

.btn {
    cursor: pointer;
    /* 绝对定位 */
    position: absolute;
    top: 0;
    left: 0;
    width: 50px;
    height: 50px;
    border: 0;
    background-color: #fff;
    font-size: 24px;
    transition: transform 0.3s ease;
}

.btn:focus,
.input:focus {
    outline: none;
}

.search.active .input {
    width: 200px;
}

.search.active .btn {
    transform: translateX(200px);
}